#ifndef LINEEDITCOMPLETELISTSHELL_H
#define LINEEDITCOMPLETELISTSHELL_H

#include "LineEditShell.h"
#include <QListWidget>
#include "../../Utils/XXlayoutConstraint.h"
#include <QSharedPointer>
#include <QSet>

#include <QPushButton>

class LineEditCompleteListShell : public LineEditShell
{
    Q_OBJECT
public:
    LineEditCompleteListShell(QObject *parent = nullptr);

    XX_KEY(kCompleteItem)
    void config(const QVariant &param);
    void configCompleteItem(const QStringList &item);

protected:
    bool eventFilter(QObject *w, QEvent *e);
    void installTarget(const QString &name, QObject *target);
    void uninstallTarget(const QString &name, QObject *target);
    void textDidChanged(QString previous, QString current);

private:
    void active(bool active);
    void popup();
    void popdown();
    void complete(const QString &begin);
    Q_SLOT void listWidget_completeList_onItemDblClicked(QListWidgetItem *item);

private:
    QStringList _completeItem;
    QListWidget _completeList;
    QPushButton _indicatorButton;
    QSet<QSharedPointer<XXlayoutConstraint*>> _layoutSet;
};

#endif // LINEEDITCOMPLETELISTSHELL_H
